home *** CD-ROM | disk | FTP | other *** search
- /* Draw a box with shadow using OpalPaint -by Carmen Rizzolo */
- /* 11/13/92 */
-
- address 'OpalPaint_Rexx'
-
- options Results
-
- AskBool 'Do you want to draw a box?'
- If Result=0 Then EXIT
-
- SaveSetUp
-
- Okay 'Pick a colour from your palette then draw the rectangle.'
-
- GetRect
- parse var Result X1 Y1 X2 Y2
-
- /* Check if box is too small */
- Width = X2 - X1
- Heigth = Y2 - Y1
- If Width > Heigth Then Do
- A = Width - 5
- End
- Else Do
- A = Heigth - 5
- End
-
- ShadowBool = 1
- If A < 0 Then Do
- Okay 'Box too small for shadows'
- ShadowBool = 0
- End
-
- GetPen
- Parse var Result R G B
- Shadow = 0
- If ShadowBool = 1 Then Do
- AskInt 0 500 'Enter Shadow distance ( RETURN = no shadow)'
- Shadow = Result
-
- If Shadow = "" Then Shadow = 0
- SX1 = X1 + Shadow
- SY1 = Y1 + Shadow
- SX2 = X2 + Shadow
- SY2 = Y2 + Shadow
- End
-
- /* Initialize */
-
- FillMode SOLID
- SetDrawMode 1
- SmoothPaper
- ClearColGrad
- ClearTransGrad
- ColourDither 0
- TransDither 0
- Trans 0
- ActiveNozzle 1
-
- /* Draw dropshadow */
-
- If Shadow > 0 Then Do
- Done = 0
- Trans 1
- SetPen 0 0 0
- If SX1 > X2 Then Do
- SolidRect SX1 SY1 SX2 SY2
- Done = 1
- End
- If SY1 > Y2 & Done = 0 Then Do
- SolidRect SX1 SY1 SX2 SY2
- Done = 1
- End
- If Done = 0 Then Do
- SolidRect (X2 + 1) SY1 SX2 SY2
- SolidRect SX1 (Y2 + 1) X2 SY2
- End
- Trans 0
- End
-
- /* Draw Cover */
- SetPen R G B
- SolidRect X1 Y1 X2 Y2
-
- /* Draw Highlights */
-
- R1 = R
- G1 = G
- B1 = B
-
- If R1 < 255 Then Do
- A = (255 - R1) / 4
- A = Trunc(A)
- R1 = R1 + A
- End
- If G1 < 255 Then Do
- A = (255 - G1) / 4
- A = Trunc(A)
- G1 = G1 + A
- End
- If B1 < 255 Then Do
- A = (255 - B1) / 4
- A = Trunc(A)
- B1 = B1 + A
- End
-
- SetPen R1 G1 B1
- Line (X1 + 1) (Y1 + 1) (X2 - 2) (Y1 + 1)
- Line (X1 + 1) (Y1 + 1) (X1 + 1) (Y2 - 2)
-
- R2 = R1
- G2 = G1
- B2 = B1
-
- If R2 < 255 Then Do
- A = (255 - R2) / 3
- A = Trunc(A)
- R2 = R2 + A
- End
- If G2 < 255 Then Do
- A = (255 - G2) / 3
- A = Trunc(A)
- G2 = G2 + A
- End
- If B2 < 255 Then Do
- A = (255 - B2) / 3
- A = Trunc(A)
- B2 = B2 + A
- End
-
- SetPen R2 G2 B2
- Line X1 Y1 (X2 - 1) Y1
- Line X1 Y1 X1 (Y2 - 1)
- SetPen 255 255 255
- Line X1 Y1 X1 Y1
-
- /* Draw Shading */
-
- R3 = R
- G3 = G
- B3 = B
-
- If R3 > 1 Then Do
- A = R3 / 4
- A = Trunc(A)
- R3 = R3 - A
- End
- If G3 > 1 Then Do
- A = G3 / 4
- A = Trunc(A)
- G3 = G3 - A
- End
- If B3 > 1 Then Do
- A = B3 / 4
- A = Trunc(A)
- B3 = B3 - A
- End
-
- SetPen R3 G3 B3
- Line (X2 - 1) (Y1 + 2) (X2 - 1) (Y2 - 2)
- Line (X2 - 1) (Y2 - 1) (X1 + 2) (Y2 - 1)
-
- R4 = R3
- G4 = G3
- B4 = B3
-
- If R4 >1 Then Do
- A = R4 / 3
- A = Trunc(A)
- R4 = R4 - A
- End
- If G4 > 1 Then Do
- A = G4 / 3
- A = Trunc(A)
- G4 = G4 - A
- End
- If B4 > 1 Then Do
- A = B4 / 3
- A = Trunc(A)
- B4 = B4 - A
- End
-
- SetPen R4 G4 B4
- Line X2 (Y1 + 1) X2 Y2
- Line X2 Y2 (X1 + 1) Y2
- SetPen 0 0 0
- Line X2 Y2 X2 Y2
-
- Okay 'Operation complete.'
- RestoreSetUp
- EXIT